#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>

#define PATHNAME "."
#define PROJ_ID 1
#define SIZE 4096

int main()
{
  key_t k = ftok(PATHNAME, PROJ_ID);
  printf("key值：%d\n", k);

  int shmid = shmget(k, SIZE,IPC_CREAT | IPC_EXCL | 0666);
  if(shmid < 0)
  {
    perror("creat failed");
    return 1;
  }

  return 0;
}
